package GUImk2;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.border.Border;

public class FullFrame extends JFrame {

	/**
	 * Serializing information.
	 */
	private static final long serialVersionUID = -9154875862291755857L;

	private SidePanel my_buttons;
	
	private MainPanel my_display;
	
	private int my_role;
	
	private FullFrame() {
		super("Burning Penguins Conference Manager");
		my_role = 0; // default user.
		this.setPreferredSize(new Dimension(850, 600));
		Border outline = BorderFactory.createLineBorder(Color.black);
		my_buttons = new SidePanel(this);
		my_buttons.updateButtons(my_role);
		my_display = new MainPanel(this);
		my_display.setBorder(outline);
		my_display.updateMainPanel(MainPanel.LAYOUT_LABELS[0]);
		this.setLayout(new BorderLayout());
		this.add(my_buttons, BorderLayout.WEST);
		this.add(my_display);
		this.pack();
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	}
	
	/**
	 * For use by actionListeners, updates the frame with button action related changes.
	 * 
	 * @param panelInfo new panel information to display.
	 * @param role role that will be active as a result of button actions.
	 */
	protected void updatePanels(final String panelInfo, final int role) {
		my_display.updateMainPanel(panelInfo);
		my_buttons.updateButtons(role);
		my_role = role;
	}
	
	/**
	 * Getter to check on current role of frame.
	 * @return the current role.
	 */
	protected int getRole() {
		return this.my_role;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new FullFrame();
		
	}

}
